package com.heima.kafka.consumer;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

@Component
public class KafkaConsumer {

   // @KafkaListener(topics ="kafka-topic")
    @KafkaListener(topics ="stream-topic")
    public void onMessage(ConsumerRecord record){
        System.out.println("消费者接受到消息了----key --- "+record.key()+" value" +record.value()
                +" 偏移量"+record.offset()
                +" 分区 "+record.partition());
//        if(!StringUtils.isEmpty(message)){
//            System.out.println("消费者接受到消息了----"+message);
//        }
    }
}
